import os
import cgi
import datetime
import wsgiref.handlers

from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template

from DataHandler import *
from CommitListener import *

class MainPage(webapp.RequestHandler):
    def get(self):
        path = os.path.join(os.path.dirname(__file__), "templates/index.html")
        self.response.out.write(template.render(path, ""))

class Suggest(webapp.RequestHandler):
    def get(self):
        path = os.path.join(os.path.dirname(__file__), "templates/suggest.html")
        self.response.out.write(template.render(path, ""))           

class About(webapp.RequestHandler):
    def get(self):
        path = os.path.join(os.path.dirname(__file__), "templates/about.html")
        self.response.out.write(template.render(path, ""))

application = webapp.WSGIApplication([
  ("/", MainPage),
  ("/data", DataHandler),
  ("/commit", CommitListener),
  ("/suggest", Suggest),
  ("/about", About)  
], debug=False)


def main():
  wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
  main()
